from langchain_community.tools import WikipediaQueryRun
from langchain_community.tools.wikipedia.tool import WikipediaQueryInput
from langchain_community.utilities import WikipediaAPIWrapper
from langchain_core.tools import BaseTool

from internal.lib import decorate


@decorate("args_schema", WikipediaQueryInput)
def wikipedia_search(**kwargs) -> BaseTool:
    return WikipediaQueryRun(
        name="wikipedia",
        description="一个用于执行维基百科搜索并提取片段和网页的工具",
        api_wrapper=WikipediaAPIWrapper()
    )
